package com.china08.yxyapi.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.mongodb.config.EnableMongoAuditing;

@Configuration
@EnableJpaAuditing
@EnableMongoAuditing
public class AuditConfig {

    @Bean
    public AuditorAware<String> auditorProvider() {
        AuditorAware<String> auditorAware = new AuditorAware<String>() {

            @Override
            public String getCurrentAuditor() {
                try {
                    // TODO 获取当前用户ID
                } catch (Exception e) {
                }
                return null;
            }
        };
        return auditorAware;
    }
}
